package com.pkuse.bjousystem.repository.student;

import com.pkuse.bjousystem.dto.student.XueShengZhuCeNianDuXueQiDTO;
import com.pkuse.bjousystem.entity.student.XueShengXuanKeJieGuo;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface XueShengXuanKeJieGuoRepository extends CrudRepository<XueShengXuanKeJieGuo, String> {
    @Query("select distinct new com.pkuse.bjousystem.dto.student.XueShengZhuCeNianDuXueQiDTO(xsxkjgb.nd, xsxkjgb.xqdm, xqdmb.xqmc) " +
            "from XueShengXuanKeJieGuo xsxkjgb inner join XueQiDaiMa xqdmb on (xqdmb.xqdm=xsxkjgb.xqdm and xsxkjgb.pzh is not null and (:xxdm is null or xsxkjgb.xxdm = :xxdm))")
    List<XueShengZhuCeNianDuXueQiDTO> listZhuCeXueQiForRegistry(@Param("xxdm") String xxdm);
}
